import { createPortal } from "react-dom";
import { FC } from "react";
import { useEffect } from "react";
const Demo: FC = (props) => {
  const div = window.document.createElement("div");
  useEffect(() => {
    const doc = window.document;
    div.classList.add("demo");
    doc.body.appendChild(div);
    return () => {
      doc.body.removeChild(div);
    };
  });
  return createPortal(
    <div className="demo_content">{props.children}</div>,
    div
  );
};
export default Demo;
